1. Technical Field
This application relates to managing concurrent I/Os in file system.
2. Description of Related Art
Computer systems may include different resources used by one or more host processors. Resources and host processors in a computer system may be interconnected by one or more communication connections. These resources may include, for example, data storage devices such as those included in the data storage systems manufactured by EMC Corporation. These data storage systems may be coupled to one or more servers or host processors and provide storage services to each host processor. Multiple data storage systems from one or more different vendors may be connected and may provide common data storage for one or more host processors in a computer system.
A host processor may perform a variety of data processing tasks and operations using the data storage system. For example, a host processor may perform basic system I/O operations in connection with data requests, such as data read and write operations.
Host processor systems may store and retrieve data using a storage device containing a plurality of host interface units, disk drives, and disk interface units. The host systems access the storage device through a plurality of channels provided therewith. Host systems provide data and access control information through the channels to the storage device and the storage device provides data to the host systems also through the channels. The host systems do not address the disk drives of the storage device directly, but rather, access what appears to the host systems as a plurality of logical disk units. The logical disk units may or may not correspond to the actual disk drives. Allowing multiple host systems to access the single storage device unit allows the host systems to share data in the device. In order to facilitate sharing of the data on the device, additional software on the data storage systems may also be used.
In data storage systems where high-availability is a necessity, system administrators are constantly faced with the challenges of preserving data integrity and ensuring availability of critical system components. One critical system component in any computer processing system is its file system. File systems include software programs and data structures that define the use of underlying data storage devices. File systems are responsible for organizing disk storage into files and directories and keeping track of which part of disk storage belong to which file and which are not being used.
File systems typically include metadata describing attributes of a file system and data from a user of the file system. A file system contains a range of file system blocks that store metadata and data. A user of a file system accesses the file system using a logical address (a relative offset in a file) and the file system converts the logical address to a physical address of a disk storage that stores the file system. Further, a user of a data storage system creates one or more files in a file system. Every file includes an index node (also referred to simply as “inode”) that contains the metadata (such as permissions, ownerships, timestamps) about that file. The contents of a file are stored in a collection of data blocks. An inode of a file defines an address map that converts a logical address of the file to a physical address of the file. Further, in order to create the address map, the inode includes direct data block pointers and indirect block pointers. A data block pointer points to a data block of a file system that contains user data. An indirect block pointer points to an indirect block that contains an array of block pointers (to either other indirect blocks or to data blocks). There may be as many as five levels of indirect blocks arranged in an hierarchy depending upon the size of a file where each level of indirect blocks includes pointers to indirect blocks at the next lower level.
Generally, data and metadata of a file of a file system read from a disk and written to a disk may be cached in a volatile memory such as a system cache of a data storage system. Caching of data and metadata of a file implies that read operations read data and metadata of the file from the volatile memory, rather than from a disk. Correspondingly, write operations may write data and metadata of a file to the volatile memory rather than to a disk. Data and metadata of a file cached in the volatile memory is written to the disk at intervals determined by an operating system of the data storage system, which is referred to as flushing of a cache. Flushing of a cache is triggered at a determinate time interval. Caching data and metadata of a file of a file system in a volatile memory improves performance of the file system as accessing data from a disk involves an I/O operation to a disk which is slower than accessing data from the volatile memory.
A write I/O request using a “file sync” option requires that a write operation directed to a file writes both data and metadata immediately to a disk rather than incurring a delay. However data and metadata may still be written into a cache. On the other hand, a write I/O request using a “data sync” option requires that data is written immediately to a disk but metadata may be cached and flushed to the disk at a later time.
Data consistency problems may arise if multiple clients or processes have concurrent access to read-write files. Typically write synchronization and file locking have been used to ensure data consistency. For example, the data write path for a file has been serialized by holding an exclusive lock on the file for the entire duration of creating a list of data buffers to be written to disk, allocating the actual on-disk storage, and writing to storage synchronously. Unfortunately, these methods involve considerable access delays due to contention for locks not only on the files but also on the file directories and a log used when committing data to storage.
In order to reduce these delays, a file server may permit asynchronous writes in accordance with version 3 of the Network File System (NFS) protocol. However, asynchronous writes and range locking alone do not eliminate access delays due to contention during allocation and commitment of file metadata. A Unix-based file in particular contains considerable metadata in the inode for the file and in indirect blocks of the file. The inode, for example, contains the date of creation, date of access, file name, and location of the data blocks used by the file in bitmap format. The NFS protocol specifies how this metadata must be managed. In order to comply with the NFS protocol, each time a write operation occurs, access to the file is not allowed until the metadata is updated on disk, both for read and write operations. In a network environment, multiple clients may issue simultaneous writes to the same large file such as a database, resulting in considerable access delay during allocation and commitment of file data and/or metadata.
Further, in order to maintain a file system in a consistent state during concurrent writes to a file of the file system, a data storage system maintains file system data structures in a random access memory of the data storage system. To enable recovery of the file system to a consistent state after a system crash, the data storage system writes file metadata to a journal (e.g., file system transaction log) in a disk array during the commit of certain write operations to the file system.